package com.mec.web.y2012.coreservlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;

/**
 * Servlet implementation class ThreeParams
 */
@WebServlet("/ThreeParamsServlet")
public class ThreeParamsServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ThreeParamsServlet() {
        super();
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		//
		String title = "Reading Three Request Parameters";
		out.println(Constants.docType + 
				"<html>\n<head><title>" + title + "</title></head>" +
				"<body bgcolor=\"#fdf5e6\">\n" +
				"<h1 align=\"center\">" + title + "<ul>\n" +
				"<li><strong>param1: </strong>" + request.getParameter("param1") +
				"</li><li><strong>param2: </strong>" + request.getParameter("param2") + "</li>" +
				"<li><strong>param3: </strong>" + request.getParameter("param3") + "</li></ul>" +
				"</body></html>"
				);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	}
	
	private static final Logger logger = 
			Logger.getLogger(ThreeParamsServlet.class);

}
